<?php

namespace addons\activityform;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Activityform extends Addons
{
    private $plug_name = 'activityform';
    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = [
            [
                'name' => $this->plug_name,
                'title' => '活动表单',
                'icon' => 'fa fa-magic',
                'sublist' => [
                    [
                        'name' => 'activityform/fromurl',
                        'title' => '表单',
                        'icon' => 'fa fa-table',
                        'sublist' => [
                            ['name' => 'activityform/fromurl/index', 'title' => '查看'],
                            ['name' => 'activityform/fromurl/add', 'title' => '增加'],
                            ['name' => 'activityform/fromurldata/detail', 'title' => '详情'],
                            ['name' => 'activityform/fromurldata/customData', 'title' => '详情中其他数据'],
                            ['name' => 'activityform/fromurldata/export', 'title' => '用户提交数据详情导出'],
                            ['name' => 'activityform/fromurl/change', 'title' => '变更'],
                            ['name' => 'activityform/fromurl/del', 'title' => '删除'],
                            ['name' => 'activityform/fromurlque/parentOptions', 'title' => '获取题目库列表']
                        ]
                    ],
                    [
                        'name' => 'activityform/fromurlque',
                        'title' => '题目库',
                        'icon' => 'fa fa-table',
                        'sublist' => [
                            ['name' => 'activityform/fromurlque/index', 'title' => '查看'],
                            ['name' => 'activityform/fromurlque/add', 'title' => '增加'],
                            ['name' => 'activityform/fromurlque/change', 'title' => '变更'],
                            ['name' => 'activityform/fromurlque/del', 'title' => '删除'],
                            ['name' => 'activityform/fromurlque/selectpage', 'title' => '下拉搜索'],
                            ['name' => 'activityform/fromurlque/parentOption', 'title' => '获取能充当父级的问题']
                        ]
                    ],
                ]
            ]
        ];
        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {

        Menu::delete($this->plug_name);
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable($this->plug_name);
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable($this->plug_name);
        return true;
    }

}
